<?php

// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, array('bootstrap' => array(
        'class' => 'Application_Bootstrap',
        'path' => APPLICATION_PATH . '/Bootstrap.php'
    )));

$application -> bootstrap();

$module = str_replace(' ', '', ucwords(str_replace(array(
    '-',
    '.'
), ' ', preg_replace('/[^a-z0-9.-]/', '', isset($_REQUEST['module']) ? $_REQUEST['module'] : 'core'))));

$name = @$_REQUEST['name'];

if (!$name)
    $name = 'lite';

$filename = APPLICATION_PATH . DIRECTORY_SEPARATOR . '/modules/' . $module . '/lites/' . $name . '.php';

if (!file_exists($filename))
{
    header("HTTP/1.0 404 Not Found");
    echo 'not found';
    if (APPLICATION_ENV === 'development')
    {
        echo $module;
        echo '<br />';
        echo $name;
        echo '<br />';
        echo $filename;
    }
    echo "\n<!-- IE and Chrome will show their own personal 404 page when the page is shorter than 512 bytes in size." . str_repeat("\n     " . str_repeat('*', 100), 5) . "\n     That should do it.\n-->";
    exit();
}

include_once $filename;
